﻿#ifndef READMEMSDATACODEC_H
#define READMEMSDATACODEC_H

#include <qobject.h>
#include "ObjAutoInject.h"

#include <qhash.h>

class Mapper_MEMSData;
class TcpCodec;
class ReadMEMSDataCodec_Server :  public QObject,public ObjAutoInject
{
  Q_OBJECT

public:
  enum ReadType{
    ReadAll=0x00,
    ReadByDateTime,
    ReadType_Size
  };
private://property
  QByteArray(ReadMEMSDataCodec_Server::*decode_fun[ReadType_Size])(QByteArray);
private://dependency
  Mapper_MEMSData* mapper_MEMSData=Q_NULLPTR;
  TcpCodec* tcpCodec=Q_NULLPTR;
public:
  explicit ReadMEMSDataCodec_Server(QObject *parent = nullptr);
  virtual ~ReadMEMSDataCodec_Server();
signals:
public:
  QByteArray code(uchar readType,QByteArray data);
  QByteArray decode(QByteArray data);
private:
  QByteArray decode_readAll(QByteArray data);
  QByteArray decode_ReadByDateTime(QByteArray data);
public://geter and seter
  Mapper_MEMSData* getMapper_MEMSData();
  void setMapper_MEMSData(Mapper_MEMSData* mapper_MEMSData);
  TcpCodec* getTcpCodec();
  void setTcpCodec(TcpCodec* tcpCodec);
public:
  virtual void objectAutoInjection(QHash<QString,QObject*>* objMap);
};

#endif // READMEMSDATACODEC_H
